﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SachOnlineLibrary.DAL;
using SachOnlineLibrary.Public;
using System.Data;
namespace SachOnlineLibrary.BLL
{
    public class TimKiemBLL
    {
        SachDAL sachDAL = new SachDAL();
        LoaiDAL loaiDAL = new LoaiDAL();
        public List<Sach> LietKeSachDangBan()
        {
            List<Sach> listsach = new List<Sach>();
            DataTable dt = new DataTable();
            dt = sachDAL.LietKeSachTheoTrangThai(true);
            foreach (DataRow dr in dt.Rows)
            {
                Sach item = new Sach();
                item.ChuyenDoi(dr);
                listsach.Add(item);
            }
            return listsach;
        }

        public List<Loai> LietKeTatCaLoai()
        {
            List<Loai> listloai = new List<Loai>();
            DataTable dt = new DataTable();
            dt = loaiDAL.LietKeTatCaLoai();
            foreach (DataRow dr in dt.Rows)
            {
                Loai item = new Loai();
                item.ChuyenDoi(dr);
                listloai.Add(item);
            }
            return listloai;
        }
    }
}
